package com.test5;

import java.io.BufferedWriter;
import java.io.FileWriter;

public class BufferedWriterTest {
    public static void main(String[] args) throws Exception {
        FileWriter fw = new FileWriter("C:\\Users\\LDH\\Desktop\\test2.txt");
        BufferedWriter buw = new BufferedWriter(fw);
        //写入
        for (int i = 0; i < 10; i++) {
            buw.write("BufferedWriter");
            buw.newLine(); //写入换行符 Windows \r\n , Linux \n
            buw.flush();
        }
        //关闭
        buw.close();
        System.out.println("执行完毕");
    }
}
